# Maintainer: Ignacio Casal Quinteiro <icq@gnome.org>

_realname=libgee
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=0.20.3
pkgrel=1
arch=('any')
pkgdesc="A collection library providing GObject-based interfaces and classes for commonly used data structures (mingw-w64)"
depends=("${MINGW_PACKAGE_PREFIX}-glib2")
makedepends=("${MINGW_PACKAGE_PREFIX}-gcc"
             "${MINGW_PACKAGE_PREFIX}-pkg-config"
             "${MINGW_PACKAGE_PREFIX}-vala"
             "${MINGW_PACKAGE_PREFIX}-gobject-introspection")
options=('strip' 'staticlibs')
license=("LGPL2+")
url="https://wiki.gnome.org/Projects/Libgee"
source=("https://download.gnome.org/sources/${_realname}/${pkgver%.*}/${_realname}-${pkgver}.tar.xz"
        0001-change-pkg-config-invocation.patch)
sha256sums=('d0b5edefc88cbca5f1709d19fa62aef490922c6577a14ac4e7b085507911a5de'
            'c581568b4538666d6f35b3b159184c244b58ffcd8cf6fc5f7809842478f2d01d')

prepare() {
  cd "${srcdir}"/${_realname}-${pkgver}
  patch -p1 -i ${srcdir}/0001-change-pkg-config-invocation.patch

  # Get proper unprefixed directories for gobject-introspection files
  autoreconf -fiv
}

build() {
  mkdir -p build-${MINGW_CHOST}
  cd build-${MINGW_CHOST}

  ../${_realname}-${pkgver}/configure \
    --host=${MINGW_CHOST} \
    --target=${MINGW_CHOST} \
    --build=${MINGW_CHOST} \
    --prefix=${MINGW_PREFIX} \
    --libexecdir=${MINGW_PREFIX}/lib

  make -j1
}

package() {
  cd "${srcdir}/build-${MINGW_CHOST}"
  make DESTDIR=${pkgdir} install

  install -Dm644 "${srcdir}/${_realname}-${pkgver}/COPYING" "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/COPYING"
}
